package com.mall.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.mall.db.domain.CouponUser;
import com.mall.db.service.CouponUserService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/system/cuc")
public class CouponUserController extends BaseController<CouponUser>{

    @Resource(name = "couponUserService")
    private CouponUserService cs;

    @Override
    public Map<String, Object> find(CouponUser c) {
        PageHelper.startPage(c.getLimit(),c.getPage());
        QueryWrapper qw = new QueryWrapper();
        List<CouponUser> list = cs.list(qw);
        PageInfo page = new PageInfo(list,c.getLimit());
        return findMap(page.getList(), page.getTotal());
    }
}
